import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MySQL {

	public static String host = "localhost";
	public static String username = "root";
	public static String password = "";
	public static String database = "";

	public static String getHost() {
		return host;
	}

	public static String getUsername() {
		return username;
	}

	public static String getPassword() {
		return password;
	}

	public static String getDatabase() {
		return database;
	}

	public static Connection conn = null;

	public static void connect() {
		String driverName = "org.gjt.mm.mysql.Driver";
		String url = "jdbc:mysql://" + getHost() + "/" + getDatabase();
		try {
			Class.forName(driverName);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		try {
			conn = DriverManager.getConnection(url, getUsername(),
					getPassword());
			if (!conn.isClosed()) {
				System.out.println("Sucessfully connected to MySQL Database: "
						+ getDatabase());
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public static void shutdown() {
		try {
			conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}